package com.efuture.vdrp.android.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class good_if_select extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("GBK");
		response.setCharacterEncoding("GBK");
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		//MySQL sql = new MySQL();
		WebApplicationContext webcontext = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext());
		MySQL sql =(MySQL)webcontext.getBean("MySQL");
		ArrayList str = sql.getGoods_info();
		//ArrayList str1 = new ArrayList();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < str.size(); i++) {
			
			String str1=sql.getGoods_info_id(Integer.parseInt((String) str.get(i)));
			sb.append(str1);
			sb.append(",");
			System.out.println(sb.toString());
		}
		String str0=sb.toString();
		out.print(str0);
		out.flush();
		out.close();
	}
}
